
const reg = /test(\d)/g;
const reg2022 = /test(\d)/dg;
const str = 'test1test2';
const arr = [...str.matchAll(reg)];
const arr2022 = [...str.matchAll(reg2022)];
console.log(arr[0]);
console.log(arr2022[0]);